import { StationVO } from '@/api/station/types';
import { VxeGridProps } from 'vxe-table';
import { BizStationDataCardVo } from '@/api/station/dataCard/types';

export function getTableConfig(): VxeGridProps<BizStationDataCardVo> {
  return {
    id: 'tenant',
    loading: false,
    height: 'auto',
    autoResize: true,
    border: 'inner',

    resizable: true,
    showOverflow: 'tooltip',
    stripe: true,
    rowConfig: {
      isHover: true,
      keyField: 'id'
      // height: 56
    },
    customConfig: {
      storage: true
    },
    columns: [
      { title: '序号', type: 'seq', width: 50 },
      { sortable: true, field: 'cardNo', title: '卡号' },
      { sortable: true, field: 'deviceId', title: '关联设备' },
      { sortable: true, field: 'deviceType', title: '关联类型' },
      { sortable: true, field: 'regionCode', title: '所在区域' },
      { sortable: true, field: 'cardType', title: '类型', slots: { default: 'type' } },
      { sortable: true, field: 'status', title: '状态', slots: { default: 'status' } },
      { sortable: true, field: 'expireTime', title: '有效期止', formatter: ({ row }) => (row.expireTime ? row.expireTime.substring(0, 10) : '-') },
      { sortable: true, field: 'restDays', title: '剩余天数' },
      { sortable: true, field: 'handle', title: '操作', width: '180px', slots: { default: 'handle' } }
    ],
    data: [] as BizStationDataCardVo[]
  };
}
